package org.nimi317.web_gis.utils;

/**
 * @author thunderobot
 */
public class PageUtils {

    public static int[] getPageRange(int current, int size, int total) {
        int realSize = Math.max(size, 1);
        int realCurrent = Math.max(current, 1);
        int start = (realCurrent - 1) * realSize;
        int end = realCurrent * realSize;
        return new int[]{Math.min(start, total), Math.min(end, total)};
    }
}
